<template>
  <div>
    <div>标题： <slot name="title">{{title}}</slot>
    </div>
    <button @click="add">点击我加一{{count}}</button>
    <div>总金额占比：
      <slot />%
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref } from "@vue/reactivity";

let count = ref(0)
const props = defineProps(['title'])
const emits = defineEmits({
  changeTotal: (value) => {
    if (!value) return false
    return true
  }
})

const add = () => {
  count.value++
  emits('changeTotal', count.value - 1)
}
</script>

<style scoped>
</style>